package top.lixunda.ecommerce.server.good.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import top.lixunda.ecommerce.server.good.api.entity.db.OrderDetailDO;

/**
 * <p>
 * VIEW Mapper 接口
 * </p>
 *
 * @author Xumda
 * @since 2019-12-18
 */
@SuppressWarnings("unused")
@Mapper
public interface OrderDetailMapper extends BaseMapper<OrderDetailDO> {

    /**
     * 插叙count，转换后的count
     *
     * @param wrapper 添加构造器
     * @return count
     */
    @Select("select count(distinct order_id) from order_detail ${ew.customSqlSegment}")
    int countConvertWrapper(@Param(Constants.WRAPPER) Wrapper<OrderDetailDO> wrapper);

    /**
     * 插叙count，转换后的count
     *
     * @return count
     */
    @Select("select count(distinct order_id) from order_detail")
    int countConvert();

}
